<?php
//ini_set('error_reporting', 'E_ALL & ~E_DEPRECATED');
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/reporter.php';
require_once dirname(__FILE__) . '/../Input/Text.php';
require_once dirname(__FILE__) . '/../Input/Checkbox.php';
require_once dirname(__FILE__) . '/../Input/Radio.php';
require_once dirname(__FILE__) . '/../Input/File.php';

class InputTest extends UnitTestCase
{
	/**
	 * INPUT TEXT TEST
	 */
	public function Test1100()
	{
		$_REQUEST[myInputText::NAME] = 'abc';
		$obj = new myInputText();
		echo $obj->fetch();
	}

	/**
	 * INPUT FILE TEST
	 */
	public function Test1110()
	{
		$_REQUEST[myInputFile::NAME] = 'abc.txt';
		$obj = new myInputFile();
		echo "\r\n***Test1110***\r\n";
		echo $obj->fetch();
	}

	/**
	 * INPUT CHECKBOX TEST
	 */
	public function Test1200()
	{
		$_REQUEST[myCheckbox::NAME][] = 'abc';
		$obj = new myCheckbox();
		echo "\r\n***Test1200***\r\n";
		echo $obj->fetchCheckbox(0);
		echo "\r\n***Test1200***\r\n";
		echo $obj->fetchCheckbox(1);
	}

	/**
	 * INPUT RADIO TEST
	 */
	public function Test1300()
	{
		$_REQUEST[myRadio::NAME] = 'bbb';
		$obj = new myRadio();
		echo "\r\n***Test1300***\r\n";
		echo $obj->fetchRadio(0);
		echo "\r\n***Test1300***\r\n";
		echo $obj->fetchRadio(1);
	}

	/**
	 * PASSWORD TEST
	 */
	public function Test1400()
	{
		$obj = new myPassword();
		echo "\r\n***Test1400***\r\n";
		echo $obj->fetch();
		echo "\r\n***Test1400***\r\n";
	}
}

class myPassword extends Hlib_Form_Input
{
	const NAME = 'mypasswd';

	public function __construct()
	{
		parent::__construct();
		$this->type = self::TYPE_PASSWORD;
		$this->name = self::NAME;
		$this->GeneralAttibutes->id = 'わたし';
	}
}

class myRadio extends Hlib_Form_Input_RadioList
{
	const NAME = 'myradio';

	public function __construct()
	{
		$this->name = self::NAME;
		$obj = new Hlib_Form_Input_Radio();
		$obj->value = 'aaa';
		$this->RadioList[] = $obj;
		$obj = new Hlib_Form_Input_Radio();
		$obj->value = 'bbb';
		$this->RadioList[] = $obj;
	}
}

class myCheckbox extends Hlib_Form_Input_CheckboxList
{
	const NAME = 'myname';

	public function __construct()
	{
		$this->name =self::NAME;
		$obj = new Hlib_Form_Inpt_Checkbox();
		$obj->value = 'abc';
		$this->CheckboxList[] = $obj;
		$obj = new Hlib_Form_Inpt_Checkbox();
		$obj->value = 'efg';
		$this->CheckboxList[] = $obj;
	}
}

class myInputText extends Hlib_Form_Inpt_Text
{
	const NAME = 'mine';
	public function __construct()
	{
		parent::__construct();

		$this->name = self::NAME;
		$this->width = 50;
	}
}

class myInputFile extends Hlib_Form_Input_File
{
	const NAME = 'myfile';
	public function __construct()
	{
		parent::__construct();

		$this->name = self::NAME;
	}
}